﻿import request from '/@/utils/request';
enum Api {
  AddProjectQa = '/api/projectQa/add',
  DeleteProjectQa = '/api/projectQa/delete',
  BatchDeleteProjectQa = '/api/projectQa/batchDelete',
  UpdateProjectQa = '/api/projectQa/update',
  GetProjectQaByCode = '/api/projectQa/getProjectByCode',
    getAgvAverage = '/api/projectQa/getAgvAverage',
  ImportProjectQa = '/api/projectQa/import',
  DownLoadProjectQa = '/api/ProjectQa/DownLoad',
  PageProjectQa = '/api/projectQa/page',
    getPageProject = '/api/projectQa/GetProjectMapDetail',
}
// 导入
export const importProjectQa = (params?: any) => {
	const formData = new FormData();
	formData.append('file', params);
	// 请求配置
	const config = {
		headers: {
		},
	};
	request({
		url: Api.ImportProjectQa,
		method: 'post',
		headers:{'Content-Type' : 'multipart/form-data'},
		data: formData,
		// data:formData
	});
}
// 增加wenjuan
export const addProjectQa = (params?: any) =>
	request({
		url: Api.AddProjectQa,
		method: 'post',
		data: params,
	});

// 删除wenjuan
export const deleteProjectQa = (params?: any) =>
	request({
			url: Api.DeleteProjectQa,
			method: 'post',
			data: params,
		});
// 批量删除wenjuan
export const batchDeleteProjectQa = (params?: any) =>
	request({
			url: Api.BatchDeleteProjectQa,
			method: 'post',
			data: params,
		});

// 编辑wenjuan
export const updateProjectQa = (params?: any) =>
	request({
			url: Api.UpdateProjectQa,
			method: 'post',
			data: params,
		});
// 根据项目获取问卷信息
export const getProjectByNo = (params?: any) =>
	request({
		url: Api.GetProjectQaByCode,
		method: 'post',
		data: params,
	});

	// 根据AGV和总生产量计算平均生产量
export const getAgvAverage = (AGV?: any,totalProductCapacity?: any) =>
	request({
		url: `${Api.getAgvAverage}/${AGV}/${totalProductCapacity}`,
				
		method: 'post',
		
	});

// 分页查询wenjuan
export const pageProjectQa = (params?: any) =>
	request({
			url: Api.PageProjectQa,
			method: 'post',
			data: params,
		});
//下载wenjuan模板
export const downLoadProjectQa = (params?: any) =>
	request({
			url: Api.DownLoadProjectQa,
			method: 'post',
			data: params,
			responseType: 'blob',
		});

		// 查询项目
		export const getpageProject = (projectNo?: any) =>
			request({
					
					url: `${Api.getPageProject}/${projectNo}`,
					method: 'get',
					
					
				});	

